<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"/>
    <meta name="renderer" content="webkit"/>
    <meta property="qc:admins" content="15317273575564615446375"/>
    <meta property="og:image" content="./img/touch-icon.png"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <meta name="alexaVerifyID" content="LkzCRJ7rPEUwt6fVey2vhxiw1vQ"/>
    <meta name="apple-itunes-app" content="app-id=958101793, app-argument=">
    <title>登录 - SegmentFault</title>
    <meta name="description" content="Segmform-groupentFault ( www.sf.gg ) 是中国领先的开发者技术社区。 我们希望为编程爱好者提供一个纯粹、高质的技术交流的平台，与开发者一起学习、交流与成长，创造属于开发者的时代！"/>
    <meta name="keywords" content="SegmentFault,黑客马拉松,IT技术社区,编程社区,技术问答,技术文章,技术笔记,技术活动,程序员招聘,开发者,程序员,极客,编程,代码,开源,hackathon"/>       
    <link rel="shortcut icon" href="/luntanshequ/Public/home/img/favicon.ico"/>
    <link rel="apple-touch-icon" href="/luntanshequ/Public/home/img/touch-icon.png">
    <meta name="msapplication-TileColor" content="#009a61"/>
    <meta name="msapplication-square150x150logo" content="./img/touch-icon.png"/>
    <link rel="stylesheet" href="/luntanshequ/Public/home/css/global.css"/>
    <link rel="stylesheet" href="/luntanshequ/Public/home/css/user.css"/>
    <link rel="stylesheet" href="/luntanshequ/Public/home/css/responsive.css"/>
    <style type="text/css">
        .form-group{
            position: relative;
        }
        .notice{
            position: absolute;
            right: 5px;
            top: 50%;
        }
        .yzms{
            position: absolute;
            right: 5px;
            top: 32px;
        }
        .loginok{
            position: absolute;
            right: 5px;
            top: 50%;
        }
    </style>
</head>

<body data-mod="user" class="user-login">

<img id="icon4weChat" style="height: 0;width: 0;" data-src="/luntanshequ/Public/home/img/touch-icon-512.png">

<img id="icon4weChat" data-src="/luntanshequ/Public/home/img/touch-icon-512.png">

<div class="container">
    <div class="header text-center">
        <h1>
            <a href="<?php echo U('home/index/index');?>" class="logo">
                <img src="/luntanshequ/Public/home/img/logo-b.svg" alt="SegmentFault">
            </a>
        </h1>
        <p class="description text-muted">欢迎加入专业的中文开发者社区</p>
    </div>
    <div class="row bg-white login">
        <div class="col-md-4 col-sm-12 col-md-push-7 login-wrap">
            <h1 class="h4 text-muted login-title mb30">用户登录</h1>
            <form action="<?php echo U('Home/Register/allowLogin');?>" method="POST" role="form" class="mt30">
                <div class="form-group" style="width:430px;">
                    <label for="mail" class="control-label">Email</label>
                    <input type="email" class="form-control checklgstatus" name="usermail" id="usermail" required placeholder="hello@segmentfault.com" key='' style="width:340px;">
                    <span class='loginok'></span>
                </div>
                <div class="form-group" style="width:430px;">
                    <label for="password" class="control-label">密码</label>
                    <input type="password" class="form-control checklgstatus" name="userpassword" id="userpassword" required placeholder="密码" style="width:340px;" key=''>
                    <span class='loginok'></span>
                </div>
                <div class="form-group clearfix">
                    <!-- <div class="checkbox pull-left">
                        <label><input name="remember" type="checkbox" value="1" checked>记住登录状态</label>
                    </div> -->
                    <button type="submit" class="btn btn-primary pull-right pl20 pr20 loginBt" disabled="disabled">登录</button>
                </div>
            </form>
            <p class="h4 text-muted visible-xs-block mb30 hidden-xs">快速登录</p>
            <div class="widget-login mt30">
                <p class="text-muted mt5 mr10 pull-left hidden-xs">快速登录</p>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-weixin visible-xs hidden"><span class="icon-sn-bg-weixin"></span><strong class="visible-xs-inline">微信账号</strong></a>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-google visible-xs"><span class="icon-sn-bg-google"></span><strong class="visible-xs-inline">Google 账号</strong></a>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-google hidden-xs"><span class="icon-sn-bg-google"></span><strong class="visible-xs-inline">Google 账号</strong></a>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-github hidden-xs"><span class="icon-sn-bg-github"></span><strong class="visible-xs-inline">Github 账号</strong></a>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-github visible-xs"><span class="icon-sn-bg-github"></span><strong class="visible-xs-inline">Github 账号</strong></a>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-weibo hidden-xs"><span class="icon-sn-bg-weibo"></span><strong class="visible-xs-inline">新浪微博账号</strong></a>

                <!-- <a href="123" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-qq visible-xs"><span class="icon-sn-bg-qq"></span><strong class="visible-xs-inline">QQ 账号</strong></a> -->

                <a href="<?php echo U('home/Register/qqLogin');?>" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-qq hidden-xs"><span class="icon-sn-bg-qq"></span><strong class="visible-xs-inline">QQ 账号</strong></a>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-weixin hidden-xs"><span class="icon-sn-bg-weixin"></span><strong class="visible-xs-inline">微信账号</strong></a>
                <a  id="showMore" href="javascript:;" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-dotted"><span class="icon-sn-bg-dotted"></span><strong class="visible-xs-inline">•••</strong></a>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sn-twitter btn-sm hidden"><span class="icon-sn-bg-twitter"></span></a>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sn-facebook btn-sm hidden"><span class="icon-sn-bg-facebook"></span></a>
                <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sn-douban btn-sm hidden"><span class="icon-sn-bg-douban"></span></a>
            </div>
        </div>

        <div class="login-vline hidden-sm hidden-xs"></div>

        <div class="col-md-4 col-md-pull-3 col-sm-12 login-wrap">
            <h1 class="h4 text-muted login-title mb30">创建新账号</h1>
            <form action="<?php echo U('Home/Register/allowRegister');?>" method="POST" role="form" class="mt30">
                <div class="form-group" style="width:430px;">
                    <label for="name"  class="control-label">用户名</label>
                    <input type="text"  class="form-control" name="username" require placeholder="字母、数字等，用户名唯一" style="width:340px;">
                </div>
                <div class="form-group" style="width:430px;">
                    <label for="mail" class="control-label">Email</label>
                    <input type="email" class="form-control checkstatus" name="email" id="email" placeholder="hello@segmentfault.com" style="width:340px;" ok=''>
                    <span class="notice"></span>
                </div>
                <div class="form-group" style="width:430px;">
                    <label for="password" class="control-label">密码</label>
                    <input type="password" class="form-control checkstatus" name="password" id="password"  placeholder="不少于 6 位" style="width:340px;" ok=''>
                    <span class="notice"></span>
                </div>
                <div class="form-group" style="width:430px;">
                    <label class="required control-label" for="captcha">验证码</label>
                    <input type="text" class="form-control checkstatus" id="verify"  placeholder="请输入下方的验证码" style="width:340px;" ok=''>
                    <div class="mt10"><a id="reloadCaptcha"  href="javascript:void(0)"><img class="captcha" src="<?php echo U('Home/Register/buildVerify');?>"  onClick="this.src=this.src+'?'+Math.random()" width="200" height="50" /></a></div>
                    <span class="notice yzms"></span>
                </div>
                <div class="form-group clearfix">
                    <div class="checkbox pull-left">
                        同意并接受<a href="/tos" target="_blank">《服务条款》</a>
                    </div>
                    <button type="submit" class="btn btn-primary pl20 pr20 pull-right checkButton" disabled="disabled">注册</button>
                </div>
            </form>
        </div>
    </div>

    <div class="text-center col-md-12 login-link">
        <a href="/user/forgot">找回密码</a>
                |
        <a href="/">首页</a>
                |
        <a href="/user/register">创建新账号</a>
    </div>
</div>
<script type="text/javascript" src="/luntanshequ/Public/js/jquery-1.7.2.js"></script>
<script type="text/javascript">
    $(document).ready(function() {

        //注册用户js
        $('#email,#password,#verify').blur(function(event) {
            var thisValue = $(this).val();
            var thisObj = $(this);
            var currentName = $(this).attr('id');
            $.ajax({
                url: '<?php echo U("Home/Register/checkInput");?>',
                type: 'POST',
                dataType: 'json',
                data: currentName + "=" + thisValue,
                success:function(data){
                    if(data.error == 0){
                        thisObj.siblings('.notice').html('<span style="color:blue">'+data.content+'</span>');
                        thisObj.attr('ok', 'ok');
                        var inputObjs = $('.checklgstatus');
                        var c = 1;
                        $.each(inputObjs, function(index, val) {
                            if($(this).attr('ok') == ''){
                                c = 0;
                            }
                        });

                        if(c){
                            $('.checkButton').removeAttr('disabled');
                        }
                    }else{
                        thisObj.siblings('.notice').html('<span style="color:red">'+data.content+'</span>');
                        thisObj.attr('ok', '');
                        $('.checkButton').attr('disabled', 'disabled');
                    }

                },
                error:function(){
                    alert('通信有误');
                },
            })
        });


        //登录js
        $('#usermail,#userpassword').blur(function(event) {
            var thisValue = $(this).val();
            var thisObj = $(this);
            var currentName = $(this).attr('id');
            if(currentName == 'userpassword'){
                if( $('#usermail').attr('key') == ''){
                    return false;
                }
            }
            
            $.ajax({
                url: '<?php echo U("Home/Register/checkLogin");?>',
                type: 'POST',
                dataType: 'json',
                data: currentName + "=" + thisValue,
                success:function(data){
                    if(data.error == 0){
                        thisObj.siblings('.loginok').html('<span style="color:blue">'+data.content+'</span>');
                        thisObj.attr('key', 'ok');

                        var inputObjs = $('.checklgstatus');
                        var c = 1;
                        $.each(inputObjs, function(index, val) {
                            if($(this).attr('key') == ''){
                                c = 0;
                            }
                        });

                        if(c){
                            $('.loginBt').removeAttr('disabled');
                        }
                    }else{
                        thisObj.siblings('.loginok').html('<span style="color:red">'+data.content+'</span>');
                        thisObj.attr('key', '');
                        $('.loginBt').attr('disabled', 'disabled');
                    }

                    if(currentName == 'usermail' && $('#usermail').attr('key') == '' ){
                        $('#userpassword').siblings('.loginok').html('');
                        $('#userpassword').attr('key','');
                    }

                },
                error:function(){
                    alert('通信有误');
                },
            })
        });
    });
</script>
</body>
</html>